/*
 *  SceneNode.h
 *  EidoTron
 *
 *  Created by Luca Di Franco on 25/03/11.
 *  Copyright 2011 Luca Di Franco. All rights reserved.
 *
 */

#include "../Entities/Vertex.h"

class Collider;
class Entity;

class SceneNode
{
	
private:
	static SceneNode*	rootSceneNode;
	static SceneNode*	playerNode;
public:
	static bool			showCollisionSolids;
	
public:
	static SceneNode*	getRootSceneNode();
	static SceneNode*	getPlayerNode();
	static void			placeCamera();
	static void			renderTree();
	
private:
	static SceneNode*	nextNode(SceneNode* currentNode);

public:
	Entity*		data;
	Collider*	collider;
	Vertex		lastKnownPosition;
	
private:
	SceneNode*	parent;
	SceneNode*	rightBrother;
	SceneNode*	firtsChild;
	float		translationMatrix[16];
	float		rotationMatrix[16];
	
private:
	SceneNode(Entity* entity);
public:
	virtual ~SceneNode();
	
	SceneNode* createChild(Entity* entity);
	SceneNode* createChildPlayerNode(Entity* entity);
	
	void setTranslate(float x, float y, float z);
	void memTranslate(float x, float y, float z);
	void memRotate(float angle, float x, float y, float z);
	void memMove(float distance);
};